package com.guanghua.brick.html.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class CoreRemoveTag extends BodyTagSupport {
	
	//private static Log logger = LogFactory.getLog(CoreElseTag.class);
	
	private String id = null;
	private String scope = "request";
	
	public int doEndTag() throws JspException {
		
		if ("request".equals(this.scope)) {
			pageContext.getRequest().removeAttribute(this.id);
		} else if ("session".equals(this.scope)) {
			pageContext.getSession().removeAttribute(this.id);
		} else if ("application".equals(this.scope)){
			pageContext.getServletContext().removeAttribute(this.id);
		} else {
			pageContext.getRequest().removeAttribute(this.id);
		}
		
		return BodyTagSupport.EVAL_PAGE;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	
}
